<template>
  <el-main>
      <el-table :data="tableData" border style="width: 100%">
        <el-table-column prop="id" label="商户ID" width="180"></el-table-column>
        <el-table-column prop="name" label="商户名称" width="180"></el-table-column>
        <el-table-column prop="corporation" label="法人"></el-table-column>
        <el-table-column prop="address" label="地址"></el-table-column>
        <el-table-column prop="type" label="类型">
          <template slot-scope="scope">
            {{scope.row.type==0?"个人职业房东":"公司化公寓"}}
          </template>
        </el-table-column>
        <el-table-column prop="status" label="状态">
          <template slot-scope="scope">
            {{scope.row.type==1?"待审核":scope.row.type==2?"审核通过":"审核不通过"}}
          </template>
        </el-table-column>
        <el-table-column prop="username" label="管理员"></el-table-column>
        <el-table-column prop="createTime"  label="申请时间"></el-table-column>
        <el-table-column label="操作">
          <template slot-scope="scope">

            <el-button @click="shenh(scope.row.id)">审核</el-button>
          </template>
        </el-table-column>
      </el-table>
      <pagination
        v-show="total>0"
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @pagination="getList"
      />
    <el-dialog
      title="审核"
      :visible.sync="dialogVisibleList"
      width="30%">
      <el-form :model="business">
        <el-form-item label="商家类型">
          {{business.type==0?'个人职业房东':'公司化公寓'}}
        </el-form-item>
        <el-form-item label="商户名称">
          {{business.name}}
        </el-form-item>
        <el-form-item label="法人">
          {{business.corporation}}
        </el-form-item>
        <el-form-item label="昵称">
          {{business.nickName}}
        </el-form-item>
        <el-form-item label="省">
          {{business.provinceName}}
        </el-form-item>
        <el-form-item label="市">
          {{business.cityName}}
        </el-form-item>
        <el-form-item label="区">
          {{business.countyName}}
        </el-form-item>
        <el-form-item label="详细地址">
          {{business.address}}
        </el-form-item>
        <el-form-item label="状态">
          {{business.status==1?'待审核':business.status==2?'审核通过':'审核不通过'}}
        </el-form-item>
        <el-form-item label="管理员">
          {{business.username}}
        </el-form-item>
        <el-form-item label="统一信征码">
          {{business.zheng}}
        </el-form-item>
        <el-form-item label="营业执照">
          <img height="200" width="150" v-bind:src="imgUrl"  class="margin">
        </el-form-item>
        <el-form-item label="申请时间">
          {{business.createTime}}
        </el-form-item>
        <el-form-item label="申请时间">
          <template slot-scope="scope">
            <el-button type="success" @click="saveOrUpdate(scope.row.status)">通过</el-button>
            <el-button type="danger" @click="notUpdate(scope.row.status)">不通过</el-button>
            <el-button @click="dialogVisibleList = false" >返回</el-button>
          </template>
        </el-form-item>

      </el-form>
    </el-dialog>
  </el-main>
</template>
<script>
import {listAudit,listByid} from "@/api/business/audit";

export default {
    name: "audit",
    data(){
      return{
        queryParams:{
          pageNum:1,
          pageSize:10,
        },
        total:0,
        tableData:[],
        business:{},
        dialogVisibleList:false,
        imgUrl:null,
      }
    },
    methods:{
      saveOrUpdate(){

      },
      notUpdate(){

      },
      shenh(id) {
        console.log(id);
        this.dialogVisibleList=true;
        listByid(id).then(response => {
            console.log(response);
            this.business=response.data;
        })
      },
      getList() {
        listAudit(this.queryParams).then(response => {
            console.log(response);
            this.tableData=response.rows;
            this.total=response.total;
          });
      },
    },

    created() {
        this.getList();
    },
  }
</script>

<style scoped>

</style>
